﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UTSDAL.LINQSQL.Model;
using UTSDAL.LINQSQL.DAO;

namespace UTSDAL.LINQSQL.Views
{
    /// <summary>
    /// This is a view that wraps a sample date to
    /// start and end times of the timetable event
    /// in order to be properly displayed in the calendar control
    /// in a weekly manner
    /// </summary>
    public class TimetableEventView
    {

        private SettingsDAO settingsDAO = new SettingsDAO();

        public TimetableEventView(TimetableEvent timetableEvent)
        {
            this.timetableEventId = timetableEvent.TimetableEventId;
            this.TimetableEvent = timetableEvent;
            this.StartTime = settingsDAO.getSampleDateForTimetableEvent(timetableEvent);
            this.StartTime = new DateTime(StartTime.Year, StartTime.Month, StartTime.Day, timetableEvent.StartTime.Hours, timetableEvent.StartTime.Minutes,0);
            

            this.EndTime = settingsDAO.getSampleDateForTimetableEvent(timetableEvent);
            this.EndTime = new DateTime(EndTime.Year, EndTime.Month, EndTime.Day, timetableEvent.EndTime.Hours, timetableEvent.EndTime.Minutes, 0);

            this.CalendarDisplayString ="(" + timetableEvent.Module.ModuleName + ")";

            

        }


        private String calendarDisplayString;

        public String CalendarDisplayString
        {
            get { return calendarDisplayString; }
            set { calendarDisplayString = value; }
        }

        private Guid timetableEventId;

        public Guid TimetableEventId
        {
            get { return timetableEventId; }
            set { timetableEventId = value; }
        }

        private TimetableEvent timetableEvent;

        public TimetableEvent TimetableEvent
        {
            get { return timetableEvent; }
            set { timetableEvent = value; }
        }

        private DateTime startTime;

        public DateTime StartTime
        {
            get { return startTime; }
            set { startTime = value; }
        }

        private DateTime endTime;

        public DateTime EndTime
        {
            get { return endTime; }
            set { endTime = value; }
        }
    }
}
